/*
 * Copyright (c) 2010-2011 NOO. All Rights Reserved.
 * [Id:DepartmentBean.java  2011-11-03 下午8:40 poplar.yfyang ]
 */
package org.mumu.pawn.beans.bam;

import org.mumu.pawn.cmps.DepartmentCmp;
import org.mumu.pawn.fm.dm.LazyPawnDataModel;
import org.mumu.pawn.domain.Department;
import org.mumu.pawn.fm.BaseBean;
import org.mumu.pawn.fm.util.QueryField;

import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;

/**
 * <p>
 * 部门管理.
 * </p>
 *
 * @author poplar.yfyang
 * @version 1.0 2011-11-03 下午8:40
 * @since JDK 1.5
 */
@Named("depBean")
@ViewScoped
public class DepartmentBean extends BaseBean<Department> {
    private static final long serialVersionUID = -7463188652199872000L;

    /**
     * 无序自定义过滤查询
     *
     * @return null
     */
    @Override
    protected List<QueryField> initQueryFields() {
        return null;
    }

    @Override
    protected LazyPawnDataModel<Department> builderDataModel() {
        return departmentCmp.createDepartmentDataModal();
    }

    @Override
    protected void doRemove() {
        departmentCmp.deleteDepartment(this.getEntity().getId());
    }

    @Override
    protected void doSave() {
        departmentCmp.saveOrUpdateDepartment(this.getEntity());
    }


    @Inject
    private DepartmentCmp departmentCmp;
}
